Skip to content

Potential fix for code scanning alert no. 3: Workflow does not contain permissions#12

Merged
friedkiwi merged 1 commit intomainfrom
alert-autofix-3
Mar 22, 2026
Merged

Potential fix for code scanning alert no. 3: Workflow does not contain permissions#12
friedkiwi merged 1 commit intomainfrom
alert-autofix-3

Conversation

@friedkiwi
Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/cyberdotgent/CSV-Explorer/security/code-scanning/3

In general, the problem is fixed by explicitly declaring minimal GITHUB_TOKEN permissions in the workflow, instead of relying on repository/organization defaults. For pure CI/build jobs that only need to read the repository, contents: read is usually sufficient. Jobs that need to publish releases or otherwise write to the repo can get limited write scopes as already done for release-windows.

The best way to fix this file without changing behavior is to add a root‑level permissions block that applies to all jobs by default, setting it to the least privilege needed for the majority of jobs (contents: read). The existing permissions block in the release-windows job already requests contents: write and will override the root default for that one job, so we should leave it intact. Concretely, we’ll insert:

permissions:
  contents: read

near the top of .github/workflows/ci.yml, after the on: block (or before env:), at the same indentation level as name, on, env, and jobs. No imports or extra methods are needed, only this YAML addition.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@friedkiwi friedkiwi marked this pull request as ready for review March 22, 2026 17:36
@friedkiwi friedkiwi merged commit fedcc11 into main Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant